<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}text.css" />
<link rel="stylesheet"
	href="${aier_css_url}${aier_jqui_css}enhanced.css" />
<link rel="stylesheet" href="${aier_css_url}proxy/cf.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/hh/ui.js"></script>
<script type="text/javascript"
	src="${aier_js_url}${aier_jqui_js}custominput.js"></script>
<script type="text/javascript"
	src="${aier_js_url}${aier_jqui_js}text.js"></script>
</head>
<body>

	<div id="tabs">
		<ul>
			<li><a href="#tabs-1">创建学校</a></li>
		</ul>
		<div id="tabs-1" style="height: 500px;">
			<div class="d_content">
				<div data-label="学校名称" class="d_scnOut">
					<div class="d_scname">
						<label for="txt_scName">学校名称:</label>
					</div>
					<div class="d_sctext">
						<input type="text" id="txt_scName" class="txt_scname">
					</div>
				</div>
				<div data-label="管理员账号" class="d_scnOut">
					<div class="d_scname">
						<label for="txt_saAccount">超级管理员账号:</label>
					</div>
					<div class="d_sctext">
						<input type="text" id="txt_saAccount" class="txt_scname">
					</div>
					<div data-label="创建账号"
						style="margin-top:-28px;margin-left: 300px;width: 300px;">
						<span id="cs_acinfor"></span>

					</div>
				</div>
				<div data-label="学校地址" class="d_scnOut"
					style="height: 70px;margin-top: 20px;">
					<div class="d_scname">
						<label for="txt_region">学校地址:</label>
					</div>
					<div class="sel_region">
						<s:action name="citiesmap_cc" namespace="/common"
							executeResult="true"></s:action>
						<div class="d_address">
							<input id="txt_region" type="text">
						</div>
					</div>
				</div>
				<div data-label="网址" class="d_scnOut">
					<div class="d_scname">
						<label for="txt_url">网址:</label>
					</div>
					<div class="d_url">
						http://<input id="txt_url" type="text">
					</div>
				</div>
				<div data-label="联系电话" class="d_scnOut">
					<div class="d_scname">
						<label for="txt_Tel">联系电话:</label>
					</div>
					<div class="d_sctext">
						<input id="txt_Tel" type="text">
					</div>
				</div>
				<div data-label="电子邮箱" class="d_scnOut">
					<div class="d_scname">
						<label for="txt_email">电子邮箱:</label>
					</div>
					<div class="d_sctext">
						<input id="txt_email" type="text">
					</div>
				</div>
				<button id="but_previous" style="margin-left: 300px;margin-top: 0px;"
					class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
					role="button" aria-disabled="false">
					<span class="ui-button-text">上一步</span>
				</button>
				<button id="but_next" style="margin-left: 100px;margin-top: 0px;"
					class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
					role="button" aria-disabled="false">
					<span class="ui-button-text">下一步</span>
				</button>
				

			</div>
		</div>

	</div>


</body>
<script type="text/javascript">
	$("#tabs").tabs();
	//上一步
	$('#but_previous').click(function() {
		location.href = "${aier_url}proxy/creates_quickCSchool${aier_suffix}";
	});
	//下一步
	$('#but_next')
			.click(
					function() {
						var fun = function(data) {
							if (data.s == 10001) {
								location.href = "${aier_url}proxy/creates_attendanceGrade${aier_suffix}?pid=${pid}";
							}

						};
						exeAjax(
								ajaxUrl("${aier_url}${aier_urijs}quicksc_ci_addlist${aier_suffix}"),
								fun, {
									"scName" : $("#txt_scName").val(),
									"adAccount" : $("#txt_saAccount").val(),
									"province" : $("#province").find(
											"option:selected").text(),
									"city" : $("#city").find("option:selected")
											.text(),
									"district" : $("#area").find(
											"option:selected").text(),
									"street" : $("#street").find(
											"option:selected").text(),
									"address" : $("#txt_region").val(),
									"website" : $("#txt_url").val(),
									"tel" : $("#txt_Tel").val(),
									"email" : $("#txt_email").val(),
									"pro_id" : $("#province").val(),
									"city_id" : $("#city").val(),
									"area_id" : $("#area").val(),
									"str_id" : $("#street").val(),
								});
					});
	//获取之前已填写好的信息
	function getinfo() {
		var fun = function(data) {
			if (data.s == 10001) {
				$("#txt_scName").val(data.scName);
				$("#txt_saAccount").val(data.adAccount);

				$("#province").val(data.pid);
				setTimeout(city(data.cid), 500);
				setTimeout(area(data.did), 1000);
				setTimeout(street(data.sid), 1500);

				$("#txt_region").val(data.address);
				$("#txt_url").val(data.website);
				$("#txt_Tel").val(data.tel);
				$("#txt_email").val(data.email);
			}
		};
		exeAjax(
				ajaxUrl("${aier_url}${aier_urijs}quicksc_getinfo${aier_suffix}"),
				fun, {

				});
	}
	getinfo();
	function city(cid) {
		$("#city").val(cid);
	}
	function area(did) {
		$("#area").val(did);
	}
	function street(sid) {
		$("#street").val(sid);
	}

	//$("#txt_saAccount").blur(function (){
	//	var fun = function (data){
	//		if(10001==data.s){
	//			$("#cs_acinfor").html("账号存在,可以直接升级为学校管理员。");
	//		}else{
	//			$("#cs_acinfor").html("该账号不存在，请重新输入。");
	//		}
	//	};
	//	exeAjax(ajaxUrl("${aier_url}${aier_urijs}createschool_pcs_check${aier_suffix}?pid=${pid}"),fun,{
	//		"scAccount" : $("#txt_saAccount").val(),
	//	});
	//	});
</script>
</html>